Remove obsolete api. Move domain control api onto xend.
return xend_get(self.domainurl(id),
{ 'op' : 'vifs' })
- def xend_domain_vif_stats(self, id, vif):
- return xend_get(self.domainurl(id),
- { 'op' : 'vif_stats',
- 'vif' : vif})
-
def xend_domain_vif_ip_add(self, id, vif, ipaddr):
return xend_call(self.domainurl(id),
{'op' : 'vif_ip_add',
'vif' : vif,
'ip' : ipaddr })
- def xend_domain_vif_scheduler_set(id, vif, bytes, usecs):
- return xend_call(self.domainurl(id),
- {'op' : 'vif_scheduler_set',
- 'vif' : vif,
- 'bytes' : bytes,
- 'usecs' : usecs })
-
- def xend_domain_vif_scheduler_get(id, vif):
- return xend_get(self.domainurl(id),
- {'op' : 'vif_scheduler_get',
- 'vif' : vif})
-
def xend_domain_vbds(self, id):
return xend_get(self.domainurl(id),
{'op' : 'vbds'})
{'op' : 'vbd',
'vbd' : vbd})
-## def xend_domain_vbd_add(self, id, uname, dev, mode):
-## return xend_call(self.domainurl(id),
-## {'op' : 'vbd_add',
-## 'uname' : uname,
-## 'dev' : dev,
-## 'mode' : mode})
-
-## def xend_domain_vbd_remove(self, id, dev):
-## return xend_call(self.domainurl(id),
-## {'op' : 'vbd_remove',
-## 'dev' : dev})
-
def xend_consoles(self):
return xend_get(self.consoleurl())
self._add_domain(dominfo.id, dominfo)
return dominfo
- def domain_device_add(self, id, info):
- """Add a device to a domain.
- """
- pass
-
- def domain_device_remove(self, id, dev):
- """Delete a device from a domain.
- """
- pass
-
- def domain_device_configure(self, id, dev, info):
- """Configure a domain device.
- """
- pass
-
#============================================================================
# Backward compatibility stuff from here on.
if not dominfo: return None
return dominfo.get_device_by_index(vif)
- def domain_vif_stats(self, dom, vif):
- dom = int(dom)
- return xc.vif_stats_get(dom=dom, vif=vif)
-
def domain_vif_ip_add(self, dom, vif, ip):
dom = int(dom)
return xenctl.ip.setup_vfr_rules_for_vif(dom, vif, ip)
- def domain_vif_scheduler_set(self, dom, vif, bytes, usecs):
- dom = int(dom)
- return xc.xc_vif_scheduler_set(dom=dom, vif=vif,
- credit_bytes=bytes, credit_usecs=usecs)
-
- def domain_vif_scheduler_get(self, dom, vif):
- dom = int(dom)
- return xc.vif_scheduler_get(dom=dom, vif=vif)
-
def domain_vbd_ls(self, dom):
dominfo = self.domain_get(dom)
if not dominfo: return []
return v
return None
-## def domain_vbd_add(self, dom, uname, dev, mode):
-## dom = int(dom)
-## vbd = vm.make_disk(dom, uname, dev, mode)
-## return vbd
-
-## def domain_vbd_remove(self, dom, dev):
-## dom = int(dom)
-## vbd = xenctl.vdisk.blkdev_name_to_number(dev)
-## if vbd < 0: return vbd
-## err = xc.vbd_destroy(dom, vbd)
-## if err < 0: return err
-## return vbd
-
def domain_shadow_control(self, dom, op):
dom = int(dom)
return xc.shadow_control(dom, op)
from twisted.internet import abstract
from twisted.internet import defer
+import Xc; xc = Xc.new()
+
import xend.utils
from xenmgr import sxp
reactor.diconnectAll()
sys.exit(0)
+ def blkif_set_control_domain(self, dom):
+ """Set the block device backend control domain.
+ """
+ return self.blkifCF.setControlDomain(dom)
+
+ def blkif_get_control_domain(self, dom):
+ """Get the block device backend control domain.
+ """
+ return self.blkifCF.getControlDomain()
+
def blkif_create(self, dom):
"""Create a block device interface controller.
d = ctrl.attach_device(vdev, mode, segment)
return d
+ def netif_set_control_domain(self, dom):
+ """Set the network interface backend control domain.
+ """
+ return self.netifCF.setControlDomain(dom)
+
+ def netif_get_control_domain(self, dom):
+ """Get the network interface backend control domain.
+ """
+ return self.netifCF.getControlDomain()
+
def netif_create(self, dom):
"""Create a network interface controller.
if console.conn:
console.conn.loseConnection()
+ def domain_start(self, id):
+ """Start domain running.
+ """
+ dom = int(id)
+ if dom <= 0: return 0
+ return xc.domain_start(dom=dom)
+
+ def domain_stop(self, id):
+ """Stop domain running.
+ """
+ dom = int(id)
+ if dom <= 0: return 0
+ xc.domain_stop(dom=dom)
+
+ def domain_destroy(self, id, force=0):
+ """Destroy a domain. Shutdown if force=0, terminate immediately if force=1.
+ """
+ dom = int(id)
+ if dom <= 0: return 0
+ return xc.domain_destroy(dom=dom, force=0)
+
+
def instance():
global inst
try: